package com.hpjpw.ido.controller;

import java.util.List;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.hpjpw.ido.domain.CheerThumb;
import com.hpjpw.ido.service.ICheerThumbService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 加油站动态点赞Controller
 * 
 * @author hpj
 * @date 2021-01-02
 */
//@Api(value ="CheerThumbController")
@RestController
@RequestMapping("/ido/cheer_thumb")
public class CheerThumbController extends BaseController
{
    @Autowired
    private ICheerThumbService cheerThumbService;

    /**
     * 查询加油站动态点赞列表
     */
    @PreAuthorize("@ss.hasPermi('ido:cheer_thumb:list')")
    @GetMapping("/list")
    //@ApiOperation("查询加油站动态点赞列表")
    public TableDataInfo list(CheerThumb cheerThumb)
    {
        startPage();
        List<CheerThumb> list = cheerThumbService.selectCheerThumbList(cheerThumb);
        return getDataTable(list);
    }

    /**
     * 导出加油站动态点赞列表
     */
    @PreAuthorize("@ss.hasPermi('ido:cheer_thumb:export')")
    @Log(title = "加油站动态点赞", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    //@ApiOperation("导出加油站动态点赞列表")
    public AjaxResult export(CheerThumb cheerThumb)
    {
        List<CheerThumb> list = cheerThumbService.selectCheerThumbList(cheerThumb);
        ExcelUtil<CheerThumb> util = new ExcelUtil<CheerThumb>(CheerThumb.class);
        return util.exportExcel(list, "cheer_thumb");
    }

    /**
     * 获取加油站动态点赞详细信息
     */
    @PreAuthorize("@ss.hasPermi('ido:cheer_thumb:query')")
    @GetMapping(value = "/{id}")
    //@ApiOperation("获取加油站动态点赞详细信息")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(cheerThumbService.selectCheerThumbById(id));
    }

    /**
     * 新增加油站动态点赞
     */
    @PreAuthorize("@ss.hasPermi('ido:cheer_thumb:add')")
    @Log(title = "加油站动态点赞", businessType = BusinessType.INSERT)
    @PostMapping
    //@ApiOperation("新增加油站动态点赞")
    public AjaxResult add(@RequestBody CheerThumb cheerThumb)
    {
        return toAjax(cheerThumbService.insertCheerThumb(cheerThumb));
    }

    /**
     * 修改加油站动态点赞
     */
    @PreAuthorize("@ss.hasPermi('ido:cheer_thumb:edit')")
    @Log(title = "加油站动态点赞", businessType = BusinessType.UPDATE)
    @PutMapping
    //@ApiOperation("修改加油站动态点赞")
    public AjaxResult edit(@RequestBody CheerThumb cheerThumb)
    {
        return toAjax(cheerThumbService.updateCheerThumb(cheerThumb));
    }

    /**
     * 删除加油站动态点赞
     */
    @PreAuthorize("@ss.hasPermi('ido:cheer_thumb:remove')")
    @Log(title = "加油站动态点赞", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    //@ApiOperation("删除加油站动态点赞")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(cheerThumbService.deleteCheerThumbByIds(ids));
    }
}
